import PictureMarkerSymbol from '@arcgis/core/symbols/PictureMarkerSymbol'

// Import facility icons
import facility from '@/assets/facility.png'
import scenic from '@/assets/scenic.png'
import viewScenicSpot from '@/assets/viewScenicSpot.png'
import service from '@/assets/service.png'
import traffic from '@/assets/traffic.png'
import green from '@/assets/green.png'
import monitor from '@/assets/monitor.png'

// 统一的图标尺寸配置
const ICON_SIZE = {
  width: 28,
  height: 28
}

// 创建统一的设施图标符号
export const facilityPointSymbol = new PictureMarkerSymbol({
  url: facility,
  width: ICON_SIZE.width,
  height: ICON_SIZE.height
})

export const scenicPointSymbol = new PictureMarkerSymbol({
  url: scenic,
  width: ICON_SIZE.width,
  height: ICON_SIZE.height
})

export const viewScenicSpotSymbol = new PictureMarkerSymbol({
  url: viewScenicSpot,
  width: ICON_SIZE.width,
  height: ICON_SIZE.height
})

export const serviceSymbol = new PictureMarkerSymbol({
  url: service,
  width: ICON_SIZE.width,
  height: ICON_SIZE.height
})

export const monitorSymbol = new PictureMarkerSymbol({
  url: monitor,
  width: ICON_SIZE.width,
  height: ICON_SIZE.height
})

export const trafficSymbol = new PictureMarkerSymbol({
  url: traffic,
  width: ICON_SIZE.width,
  height: ICON_SIZE.height
})

export const greenSymbol = new PictureMarkerSymbol({
  url: green,
  width: ICON_SIZE.width,
  height: ICON_SIZE.height
})

// 设施类型到图标的映射
export const facilityTypeSymbolMap = {
  '驿站': scenicPointSymbol,
  '景点': viewScenicSpotSymbol,
  '餐饮': serviceSymbol,
  '监控': monitorSymbol,
  '交通': trafficSymbol,
  '绿化': greenSymbol,
  'default': facilityPointSymbol
}

// 获取设施类型对应的图标
export function getFacilitySymbol(facilityType: string): PictureMarkerSymbol {
  return facilityTypeSymbolMap[facilityType as keyof typeof facilityTypeSymbolMap] || facilityTypeSymbolMap.default
}
